styleproperty: Add a compute vfunc
authorBenjamin Otte <otte@redhat.com>
Mon, 2 Jan 2012 16:50:32 +0000 (17:50 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 9 Jan 2012 17:37:55 +0000 (18:37 +0100)
gtk/gtkcssstyleproperty.c
gtk/gtkcssstylepropertyprivate.h

index 2f542449f98a1bb71f7cdd9c2618ddd0af57cb49..e3580775ab128b7270d18677506821deb2000b4a 100644 (file)
@@ -218,10 +218,20 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
   klass->style_properties = g_ptr_array_new ();
 }
 
+static void
+gtk_css_style_property_real_compute_value (GtkCssStyleProperty *property,
+                                           GValue              *computed,
+                                           GtkStyleContext     *context,
+                                           const GValue        *specified)
+{
+  g_value_init (computed, _gtk_style_property_get_value_type (GTK_STYLE_PROPERTY (property)));
+  _gtk_css_style_compute_value (computed, context, specified);
+}
 
 static void
-_gtk_css_style_property_init (GtkCssStyleProperty *style_property)
+_gtk_css_style_property_init (GtkCssStyleProperty *property)
 {
+  property->compute_value = gtk_css_style_property_real_compute_value;
 }
 
 /**
@@ -338,8 +348,7 @@ _gtk_css_style_property_compute_value (GtkCssStyleProperty *property,
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
   g_return_if_fail (G_IS_VALUE (specified));
 
-  g_value_init (computed, _gtk_style_property_get_value_type (GTK_STYLE_PROPERTY (property)));
-  _gtk_css_style_compute_value (computed, context, specified);
+  property->compute_value (property, computed, context, specified);
 }
 
 /**
index c02a766892d1e22e28bb0d45b865ddc893202c94..a8f6dce38d5e13d6cf095950bd943c89725e928d 100644 (file)
@@ -35,6 +35,10 @@ G_BEGIN_DECLS
 typedef struct _GtkCssStyleProperty           GtkCssStyleProperty;
 typedef struct _GtkCssStylePropertyClass      GtkCssStylePropertyClass;
 
+typedef void             (* GtkCssStylePropertyComputeFunc)(GtkCssStyleProperty    *property,
+                                                            GValue                 *computed,
+                                                            GtkStyleContext        *context,
+                                                            const GValue           *specified);
 struct _GtkCssStyleProperty
 {
   GtkStyleProperty parent;
@@ -42,6 +46,8 @@ struct _GtkCssStyleProperty
   GValue initial_value;
   guint id;
   guint inherit :1;
+
+  GtkCssStylePropertyComputeFunc compute_value;
 };
 
 struct _GtkCssStylePropertyClass